<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Images manager</title>
        <link type="text/css" rel="stylesheet" href="styles/admin.css" />
        <link type="text/css" rel="stylesheet" href="styles/thickbox.css" />
        <link type="text/css" rel="stylesheet" href="styles/jquery.alerts.css" media="screen"/>
        <script type="text/javascript" src="js/jquery.min.js"></script>
        <script type="text/javascript" src="js/jquery.MultiFile.pack.js"></script>
        <script type="text/javascript" src="js/jquery.alerts.js"></script>
        <script type="text/javascript" src="js/common.js"></script>
        <script type="text/javascript" src="js/ckeditor/ckeditor.js"></script>
        <script type="text/javascript" src="js/thickbox/thickbox-compressed.js"></script>
        <script type="text/javascript">
        	var url ='<?php echo $_SERVER['PHP_SELF']; ?>' ;
        	
        	$(document).ready(function (){
		        CKEDITOR.config.resize_enabled = false;
		        CKEDITOR.config.width = 560;
		        CKEDITOR.config.height = 50;
		        CKEDITOR.replace( 'message',
		        {
		            toolbar :
		                [[ '-','Format','Font','FontSize','-','TextColor','BGColor','-','Bold','Italic','Underline','Strike','-','-','-', '-','-', '-', 'Link', 'Unlink' ]]
		        });

                $('td.grid a[href^="http://"]')
                .attr({
                  target: "_blank",
                  title: "Opens in a new window"
                });
		    });
		    
            function openListAllNote(){
                window.parent.location.href=url + '?module=note';
                window.parent.tb_remove();
            }
            
            function submitFormEditNote(submitType){
		        if(submitType=='exit'){
		            $("#submitType").val('exit');
		            $("#submitFrmNoteAdd").click();
		        }
		    }

            function delNote(params,text){
                confirm_get("Do you want to delete "+text+"?",'<?php echo ADMIN_URL;?>'+params);
            }

        </script>
        <style>
        	table.grid{
        		font-size:11px;
        		line-height:25px;
        		border-left:1px solid #D9E6F0;
        		border-top:1px solid #D9E6F0;
        	}
        	td.grid{
        		border-right:1px solid #D9E6F0;
        		border-bottom:1px solid #D9E6F0;
        		padding:5px;
        	}
            td.grid-c{
        		border-right:1px solid #D9E6F0;
        		border-bottom:1px solid #D9E6F0;
        		padding:5px;
                text-align: center;
        	}
        	th.grid{
        		border-right:1px solid #D9E6F0;
        		border-bottom:1px solid #D9E6F0;
        	}
            div.scroll{
               height:100px;
               overflow-y:auto;
               overflow-x:hidden;
               width:595px ;
            }

        </style>
	</head>
<body bgcolor="#fff">
<?php
    if(isset($_GET['del'])){
       delNote();
    }
?>
<div class="container_2">
<div class="title_user"><img src="images/icon1.gif" style="float:left;" /><span style="float:left;line-height:25px; padding-left:5px;">Add Note - </span><a style="float:left;line-height:25px; font-weight:bold; padding-right:5px;; padding-left:5px;" href='javascript:;' title="View All Note" onClick="return openListAllNote()">View All</a></div>
<div class="table_user">
<div class="scroll">
  <table cellpadding="0" cellspacing="0" width="100%" class="grid">
  	<tr>
  		<th class="grid">Date</th>
  		<th class="grid">Message</th>
        <th class="grid">Setting</th>
  	</tr>
  	<?php
  	     $rsNote = listNote();
  	     if($db->num_rows($rsNote)) {
           	while($rs=$db->fetch_array($rsNote)) {
    ?>
  	<tr>
  		<td class="grid"><?php echo date('d/m/Y',strtotime($rs['date']));?></td>
  		<td class="grid"><?php echo $rs['message'];?></span></td>
        <td class="grid-c" style="width:40px;">
            <a href="<?php echo ADMIN_URL; ?>/index.php?module=note&action=edit&id=<?php echo $rs["id"]; ?>" >
                        <img src="images/edit.gif" alt="edit" title="edit" />
							</a>&nbsp;
            <a href="javascript: delNote('?module=note&action=add&del=ok&id=<?php echo $rs['id'];?>','<?php echo htmlentities($note['message'], ENT_COMPAT, 'UTF-8');?>')"><img src="images/delete.gif" alt="Delete" title="Delete" /></a>
        </td>
  	</tr>
  	<?php
  	      	}
  	      }
      ?>
  </table>
  </div>

  <br />
  <table cellpadding="0" cellspacing="0" width="100%">
    <tr>
        <td>
        <form action="" method="post" name="formNoteAdd">
          <?php
           show_error();
           show_success();
          ?>
              <div class="lineaddnew">
                  <div class="lineform">
                      <div class="divform">Message: <font color="#FF0000">( * )</font></div>
                      <div class="divform"><textarea id="message" name="message"></textarea></div>
                      <div class="linesubmit">
		                <input type="hidden" name="submitType" id="submitType" value="">


                       <input type="submit" id="submitFrmNoteAdd" name="submitFrmNoteAdd" value="Add" class="button" />
                       <input type="button" name="submitFrmNoteEditAndExit" onclick="submitFormEditNote('exit');" value="Add & Exit" class="button" />
               	</div>
                  </div>
              </div>
          </form>
        </td>
    </tr>
  </table>
  </div>
</div>
</body>
</html>
